/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Utilities;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 *
 * @author NguyenPhuThien
 */
public class Encrypt {

    public static String encryptMD5(String text) throws NoSuchAlgorithmException
    {
            MessageDigest mdEnc = MessageDigest.getInstance("MD5"); // Encryption algorithm
            mdEnc.update(text.getBytes(), 0, text.length());
            
            return new BigInteger(1, mdEnc.digest()).toString(16); // Encrypted string
    }

}
